// 轮播图模型
const { Banner } = require('../../../models/banner');
// 统一数据返回类
const { DataReturn } = require('../../../common/returnclass');

/**
 * @api {Post} /banners 创建轮播图
 * @apiGroup Admin-Banners
 *
 * @apiParam {String} banner_url 权限名称
 *
 * @apiSuccess {Number} code 状态码
 * @apiSuccess {Object} data 返回数据
 * @apiSuccess {String} msg  返回消息
 */
module.exports = async (req, res) => {
	
	let { banner_url } = req.fields;
	console.log(req.fields);
	Banner.update(req.fields)
	.then(()=>{
		DataReturn.getData(res, 200, [], '上传成功')
	}).catch((err)=>{
		DataReturn.getData(res, 400, err, '上传失败')
	})

}
